package com.leo.foodmaster.admin.system.mapper;

import com.leo.foodmaster.admin.system.entity.Organ;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.leo.foodmaster.commons.entity.TreeSelect;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 机构表 Mapper 接口
 * </p>
 *
 * @author Leo
 * @since 2021-06-23
 */
public interface OrganMapper extends BaseMapper<Organ> {

    /**
     * 根据机构Id查询子机构列表
     * @param organId 机构Id
     * @return List<TreeSelect>
     */
    @Select("SELECT id, `name` AS label " +
            "FROM sys_organ " +
            "WHERE organ_id = #{organId} AND status = '0' AND del_flag = 0 ")
    List<TreeSelect> selectChildren(Long organId);
}
